<div id="notifications_settings" class="panel panel-default">
  <header class="panel-heading">
    <h5>
      <%= link_to t('settings.notifications.briefing'),  "javascript:void(0);", class: 'accordion-toggle', "data-toggle" => 'collapse', "data-parent" => "#settings-accordion", "data-target" => "#notifications_settings_content" %>
    </h5>
  </header>

  <div class="panel-body collapse" id="notifications_settings_content">
    <%= form_tag update_all_settings_path, :method => :put do %>
      <div class="form_label">
        <label><%= t('settings.notifications.by_email.name') %> </label>
      </div>

      <div class="options">
        <label>
          <%= radio_button_tag :notify_by_email, 'always', current_subject.notify_by_email %>
          <span class="lbl padding-0">
            <%= t('settings.notifications.by_email.always') %>
          </span>
        </label>
        <label>
          <%= radio_button_tag :notify_by_email, 'never', !current_subject.notify_by_email %>
          <span class="lbl padding-0">
            <%= t('settings.notifications.by_email.never') %>
          </span>
        </label>
      </div>

      <% SocialStream.default_notification_settings.keys.each do |key| %>
        <div class="form_label">
          <label> <%= [t("settings.notification_settings.prefix"), t("settings.notification_settings.#{key}")].join " " %> </label>
          </div> 
          <div class="options">
            <label>
              <%= radio_button_tag "notification_settings[#{key}]", 'always', current_subject.notification_settings[key] %>
              <span class="lbl padding-0">
                <%= t('settings.notifications.by_email.always') %>
              </span>
            </label>
            <label>
              <%= radio_button_tag "notification_settings[#{key}]", 'never', !current_subject.notification_settings[key] %>
              <span class="lbl padding-0">
                <%= t('settings.notifications.by_email.never') %>
              </span>
            </label>
          </div>
      <% end %>

      <%= hidden_field_tag :settings_section, :notifications, {:id => 'notifications_field'} %>
        <%= submit_tag t('button.update'), :class => "btn btn-primary", "data-loading-text" => t('button.sending') %>
    <% end %>

    <%= content_for :javascript do %>
      $("#notifications_settings form [type='submit']").click(function(event) {
        $(this).button('loading');
      });
    <%end%>
    
  </div>
</div>

